# Copyright 2021, Régis Décamps
# SPDX-License-Identifier: BSD-3-Clause

load("@jflex_rules//jflex:jflex.bzl", "jflex")
load("//scripts:check_deps.bzl", "check_deps")

check_deps(
    name = "deps_to_bootstrap_jflex_test",
    prohibited = "@jflex_rules//jflex:jflex_bin",
)

# cclmacros

jflex(
    name = "gen_cclmacros_scanner",
    srcs = ["cclmacros.flex"],
    jflex_bin = "//jflex:jflex_bin",
    outputs = ["Cclmacros.java"],
)

java_library(
    name = "cclmacros_scanner",
    srcs = [
        ":gen_cclmacros_scanner",
    ],
    deps = [
        "//third_party/com/google/guava",
    ],
)

java_test(
    name = "CclmacrosGoldenTest",
    size = "small",
    srcs = [
        "CclmacrosGoldenTest.java",
    ],
    data = [
        "cclmacros-0.input",
        "cclmacros-0.output",
    ],
    deps = [
        ":cclmacros_scanner",
        "//java/de/jflex/testing/testsuite/golden",
        "//java/de/jflex/util/scanner:scanner_factory",
        "//third_party/com/google/guava",
        "//third_party/com/google/truth",
    ],
)

java_test(
    name = "CclMacrosNegTest",
    size = "small",
    srcs = [
        "CclMacrosNegTest.java",
    ],
    data = [
        "ccl_macros_neg.flex",
        "ccl_macros_neg-flex.output",
    ],
    deps = [
        "//java/de/jflex/testing/testsuite",
        "//jflex/src/main/java/jflex/exceptions",
    ],
)
